package com.str.controller;

import com.str.annotation.PrintLog;
import com.str.dto.QueryKitOfLocusInfosDto;
import com.str.dto.QueryLocusOfAlleleInfosDto;
import com.str.service.DataStatisticsService;
import com.str.vo.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;


/**
 * @Author: ZhangWu, Anything is possible!
 * @CreateTime: 2023/04/19 21:15
 * @Description: 数据统计控制器
 */
@RestController
@RequestMapping("dataStatistics")
@Slf4j
@Api(value = "数据统计API", tags = "数据统计API")
public class DataStatisticsController {

    @Resource
    private DataStatisticsService dataStatisticsService;


    /**
     * 按试剂盒统计其基因座个数及其占比
     *
     * @param dto 筛选条件
     * @return 查询结果
     */
    @ApiOperation("按试剂盒统计其基因座个数及其占比")
    @PostMapping("/queryKitOfLocusInfos")
    @PrintLog(desc = "按试剂盒统计其基因座个数及其占比")
    public ResponseVO queryKitOfLocusInfos(@RequestBody QueryKitOfLocusInfosDto dto, HttpServletRequest request) {
        return dataStatisticsService.queryKitOfLocusInfos(dto, request);
    }

    /**
     * 按基因座（x轴坐标）统计其等位基因个数及其峰面积（y轴坐标）-柱状图
     *
     * @param dto 筛选条件
     * @return 查询结果
     */
    @ApiOperation("按基因座（x轴坐标）统计其等位基因个数及其峰面积（y轴坐标）-柱状图")
    @PostMapping("/queryLocusOfAlleleInfos")
    @PrintLog(desc = "按试剂盒统计其基因座个数及其占比")
    public ResponseVO queryLocusOfAlleleInfos(@RequestBody QueryLocusOfAlleleInfosDto dto, HttpServletRequest request) {
        return dataStatisticsService.queryLocusOfAlleleInfos(dto, request);
    }

    /**
     * 按组分数统计基因座占比-饼状图
     *
     * @return 查询结果
     */
    @ApiOperation("按组分数统计基因座占比-饼状图")
    @PostMapping("/queryLocusOfComNumber")
    @PrintLog(desc = "按组分数统计基因座占比")
    public ResponseVO queryLocusOfComNumber(HttpServletRequest request) {
        return dataStatisticsService.queryLocusOfComNumber(request);
    }
}
